const fs = require('fs')
// 读取数据库
const userString = fs.readFileSync('./db/users.json').toString()
const userArray = JSON.parse(userString)
console.log(userArray)

// 写数据库
const user2 = {"id":2,"name":"weiran","password":"111"}
userArray.push(user2)
const string = JSON.stringify(userArray)
fs.writeFileSync('./db/users.json',string)
console.log(userArray)